# Contributor: Keith Maxwell <keith.maxwell@gmail.com>
# Maintainer: Keith Maxwell <keith.maxwell@gmail.com>
pkgname=py3-grpcio
pkgver=1.30.0
pkgrel=0
pkgdesc="gRPC Python HTTP/2-based RPC framework"
url="https://grpc.io"
arch="all !ppc64le"  # no ppc64le -needs UnscaledCycleClock::Frequency()
license="Apache-2.0"
makedepends="python3-dev py3-setuptools py3-six cython zlib-dev openssl-dev
	c-ares-dev linux-headers"
options="!check" # tests depend upon bazel
_abseil_cpp_rev=df3ea785d8c30a9503321a3d35ee7d35808f190d
source="grpc-$pkgver.tar.gz::https://github.com/grpc/grpc/archive/v$pkgver.tar.gz
		abseil-cpp-$_abseil_cpp_rev.tar.gz::https://github.com/abseil/abseil-cpp/archive/$_abseil_cpp_rev.tar.gz
	"

builddir="$srcdir/grpc-$pkgver"

unpack() {
	default_unpack

	# the archive is missing git submodules
	rmdir "$builddir/third_party/abseil-cpp"
	ln -sn "$srcdir/abseil-cpp-$_abseil_cpp_rev/" "$builddir/third_party/abseil-cpp"
}

export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=1
export GRPC_PYTHON_BUILD_SYSTEM_CARES=1
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
export GRPC_PYTHON_BUILD_CYTHON=1

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="dd33a58562f35c0b8eb0e3e6f60f12b262abe1e8388e3d596b90d62324436eea6011aaf6487d35da64c1a0b6c62270d6e4283457964af01a3219bc31294fd624  grpc-1.30.0.tar.gz
b429758c37749d3d5c5c220fe0dc00fa0e193b406545484095339b25674c4a3bb7850b76dd1a370ed2006729bcbbbb1b438995b614e149c2290bdb10038c49d1  abseil-cpp-df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz"
